package com.twu.biblioteca.reservation;

import com.twu.biblioteca.exceptions.BookAlreadyReservedException;
import com.twu.biblioteca.exceptions.InexistantBookException;
import com.twu.biblioteca.exceptions.InvalidBookIdException;
import com.twu.biblioteca.model.BookList;

import java.io.PrintStream;
import java.util.UUID;

/**
 * Created with IntelliJ IDEA.
 * User: cschlumb
 * Date: 07/08/2013
 * Time: 15:08
 * To change this template use File | Settings | File Templates.
 */
public class ReservationSystem {
    public void reserve(BookList bookList, ReservationParser reservationParser, PrintStream printStream) {
        try{
            UUID uuid = reservationParser.parseInput();
            bookList.reserve(uuid);
            printStream.println("Thank You! Enjoy the book.");
        } catch (InvalidBookIdException e){
            printStream.println("Sorry we don't have that book yet.");
        } catch (InexistantBookException e){
            printStream.println("Sorry we don't have that book yet.");
        } catch (BookAlreadyReservedException e){

        }
    }
}
